# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>

pkgname=libdom
pkgver=0.4.1
pkgrel=2
pkgdesc='Implementation of the W3C DOM'
arch=(loong64 x86_64)
url='https://www.netsurf-browser.org/projects/libdom/'
license=(MIT)
depends=(expat 'libhubbub>=0.3.7' 'libwapcaplet>=0.4.3')
makedepends=(netsurf-buildsystem)
source=("https://download.netsurf-browser.org/libs/releases/$pkgname-$pkgver-src.tar.gz")
sha256sums=('98ee072471e55e208c9878e515c410ad462ca36f87b4afcbecad023f3a2cef4a')

prepare() {
  sed -i 's:_BSD_SOURCE:_DEFAULT_SOURCE:' "$pkgname-$pkgver/Makefile"
}

build() {
  export CFLAGS="$CFLAGS -shared -fPIC -w"
  export LDFLAGS="$LDFLAGS -shared -z,now"
  make -C "$pkgname-$pkgver" \
    INCLUDEDIR=include \
    LIBDIR=lib \
    PREFIX=/usr \
    COMPONENT_TYPE="lib-shared"
}

package() {
  make -C "$pkgname-$pkgver" \
    DESTDIR="$pkgdir" \
    INCLUDEDIR=include \
    LIBDIR=lib \
    PREFIX=/usr \
    COMPONENT_TYPE="lib-shared" \
    install

  install -Dm644 "$pkgname-$pkgver/COPYING" \
    "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}

# getver: source.netsurf-browser.org/libdom.git/tree/Makefile
# vim: ts=2 sw=2 et:
